#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_tuple.py
# author:wmf
# datetime:2021/3/11 14:05
# software: PyCharm
'''
this is function description
'''
# import module your need

info_tuple = ("zhangsan",18,1.75)

#1.取值和取索引
print(info_tuple[0])
#已经知道数据的内容，希望知道该数据在元组中的索引
print(info_tuple.index("zhangsan"))

#2.统计计数
print(info_tuple.count("zhangsan"))
#统计元组中包含的元素的个数
print(len(info_tuple))

#使用迭代遍历元组
for my_info in info_tuple:
    print(my_info)

#格式化字符串后面的‘()’本质上就是元组
print("%s 年龄是 %d 身高是 %.2f"%("小明",18,1.75))
print("%s 年龄是 %d 身高是 %.2f" % info_tuple)

info_str = "%s 年龄是 %d 身高是 %.2f" % info_tuple
print(info_str)

num_list = [1,2,3,4]
print(type(num_list))
num_tuple = tuple(num_list)
print(type(num_tuple))
num2_list = list(num_tuple)
print(type(num2_list))